/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.delegates;
import cassys.dataaccess.DAOException;
import cassys.datatransferobjects.LecturerDTO;
import cassys.datatransferobjects.StudentDTO;
import cassys.servicelocator.ServiceLocator;
import java.rmi.RemoteException;
import java.util.ArrayList;
import cassys.datatransferobjects.UserDTO;
import cassys.ejb.sessionbean.LecturerBeanRemote;
import cassys.ejb.sessionbean.StudentBeanRemote;
import cassys.ejb.sessionbean.UserBeanRemote;



public class StudentDelegate {
        private StudentBeanRemote studentBean  = null;
     
   
     
     public StudentDelegate() {
       studentBean= (StudentBeanRemote) ServiceLocator.getInstance().lookupStudentBean();
    }
    
    public ArrayList <StudentDTO> findAllStudents() throws DAOException, RemoteException {
        ArrayList <StudentDTO> list = (ArrayList <StudentDTO>) studentBean.findAllStudents();
        return list;
    }
    
    public StudentDTO findStudent(String userId) throws DAOException, RemoteException {
        return studentBean.findStudent(userId);
    }
    
    public void updateStudent(StudentDTO student) throws DAOException, RemoteException {
        studentBean.updateStudent(student);
    }
    
    public void insertStudent(StudentDTO student) throws DAOException, RemoteException {
        studentBean.insertStudent(student);
    }
    
    public void deleteStudent(StudentDTO student) throws DAOException, RemoteException {
        studentBean.deleteStudent(student);
    }
    
    public boolean lecturerValidate(String userid, String password) throws DAOException, RemoteException {
         return (studentBean.studentValidate(userid.trim(), password.trim()));
    }
    
     
}
